
if (NOT DEFINED LUAGUI_ROOT_DIRECTORY)
    set(LUAGUI_ROOT_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()
message("LUAGUI_ROOT_DIRECTORY:" ${LUAGUI_ROOT_DIRECTORY})

# options
include(${LUAGUI_ROOT_DIRECTORY}/cmake/option.cmake)

if (NOT DEFINED PREBUILT_LIBS_DIRECTORY)
    set(PREBUILT_LIBS_DIRECTORY ${LUAGUI_ROOT_DIRECTORY}/libs/${PLATFORM_NAME_LOWER})
    message("PREBUILT_LIBS_DIRECTORY:" ${PREBUILT_LIBS_DIRECTORY})
endif() 

#sdl2
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/SDL2-2.0.22/include)
list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/SDL2-2.0.22/lib/libSDL2.a)

#lua
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/lua-5.4.4/include)
list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/lua-5.4.4/lib/liblua.a)
#LuaBridge
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/LuaBridge-2.6/include)
#cairo
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/cairo-1.16.0/include)
list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/cairo-1.16.0/lib/libcairo.a)
#freetype
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/freetype-2.12.0/include)              # android
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/freetype-2.12.0/include/freetype2)    # linux
list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/freetype-2.12.0/lib/libfreetype.a)
#pixman
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/pixman-0.40.0/include)
list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/pixman-0.40.0/lib/libpixman-1.a)
#libpng
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/libpng-1.6.35/include)
list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/libpng-1.6.35/lib/libpng16.a)

#zlib
#list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/zlib-1.2.12/include)
#list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/zlib-1.2.12/lib/libz.a)

#iconv
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/libiconv-1.16/include)
list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/libiconv-1.16/lib/libiconv.a)
#tinyxml
list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/tinyxml2-9.0.0/include)
list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/tinyxml2-9.0.0/lib/libtinyxml2.a)

#lcurl
if (USE_LUA_CURL)
	#list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/Lua-cURLv3-0.3.13/include)
	list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/Lua-cURLv3-0.3.13/lib/liblcurl.a)
endif()

#curl
if (USE_CURL)
	list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/curl-7.82.0/include)
	list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/curl-7.82.0/lib/libcurl.a)
endif()

#openssl
if (USE_OPENSSL)
	list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/openssl-3.0.2/include)
	list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/openssl-3.0.2/lib/libssl.a)
	list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/openssl-3.0.2/lib/libcrypto.a)
endif()

#luv
if (USE_LUV)
	#list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/luv-1.44.2/include)
	list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/luv-1.44.2/lib/libluv.a)
endif()

#libuv
if (USE_LIBUV OR USE_LUV)
	list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/libuv-1.44.1/include)
	list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/libuv-1.44.1/lib/libuv_a.a)
endif()

#spdlog
if (USE_SPDLOG)
	list(APPEND LIBS_INCLUDE_LIST ${PREBUILT_LIBS_DIRECTORY}/spdlog-1.10.0/include)
	list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/spdlog-1.10.0/lib/libspdlog.a)
endif()

#md5
if (USE_LUA_MD5)
	list(APPEND LIBS_LIBRARY_LIST ${PREBUILT_LIBS_DIRECTORY}/md5-1.3/lib/liblua-md5.a)
endif()

target_include_directories(${PROJECT_NAME} PUBLIC ${LIBS_INCLUDE_LIST})
target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBS_LIBRARY_LIST})

